package org.dolphin.util;

public class Pagination {
  public static int calculateStartIndex(int page, int rows) {
    if (page > 0 && rows > 0) {
      return ((page - 1) * rows);
    }
    return -1;
  }

  public static int calculateTotalPage(long records, int rows) {
    if (records > 0 && rows > 0) {
      int page = (int) Math.ceil(((double) records) / rows);
      return page;
    }
    return 1;
  }
}
